package com.mall.user.feign;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mall.common.util.JsonResult;
import com.mall.user.model.dto.favorite.UserFavoriteAddRequest;
import com.mall.user.model.dto.favorite.UserFavoriteQueryRequest;
import com.mall.user.model.entity.UserFavorite;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 收藏服务 Feign 客户端
 */
@FeignClient(name = "userFavorite-api", path = "/favorite")
public interface FavoriteFeignClient {

    /**
     * 添加收藏
     */
    @PostMapping("/add")
    JsonResult<Boolean> addFavorite(@RequestBody UserFavoriteAddRequest favoriteAddRequest);

    /**
     * 移除收藏
     */
    @PostMapping("/remove")
    JsonResult<Boolean> removeFavorite(HttpServletRequest request);

    /**
     * 检查收藏状态
     */
    @GetMapping("/check")
    JsonResult<Boolean> checkFavoriteStatus(@RequestParam("productId") Long productId);

    /**
     * 分页获取用户收藏列表
     */
    @PostMapping("/list/page")
    JsonResult<Page<UserFavorite>> getUserFavorites(@RequestBody UserFavoriteQueryRequest favoriteQueryRequest);
}
